home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / EditorCenterPanMachine.as < prev    next >
Text File  |  2007-09-27  |  4KB  |  151 lines

  1. class EditorCenterPanMachine extends Library.State
  2. {
  3.    function EditorCenterPanMachine(__mcRef, __oParentMachine)
  4.    {
  5.       super(__mcRef);
  6.       this.oParentMachine = __oParentMachine;
  7.       Main.__get__Instance().doAddListener(this);
  8.    }
  9.    function setNumber(__nNumber)
  10.    {
  11.       this.nNumber = __nNumber;
  12.       this.doChangeNumber();
  13.       this.doSetUpIdle();
  14.    }
  15.    function setRef(__mcRef)
  16.    {
  17.       this.mcRef = __mcRef;
  18.       this.sState = "___RESET___";
  19.       this.setState("Idle");
  20.    }
  21.    function doScrollUp()
  22.    {
  23.       this.setState("Raise");
  24.    }
  25.    function doScrollDown()
  26.    {
  27.       this.setState("Lower");
  28.    }
  29.    function doRefreshVisual()
  30.    {
  31.       this.doLoadStateAction();
  32.    }
  33.    function doDestroy()
  34.    {
  35.       Main.__get__Instance().doRemoveListener(this);
  36.    }
  37.    function doRaise()
  38.    {
  39.       if(this.isStateComplete())
  40.       {
  41.          this.setState("Idle");
  42.       }
  43.    }
  44.    function doLower()
  45.    {
  46.       if(this.isStateComplete())
  47.       {
  48.          this.setState("Idle");
  49.       }
  50.    }
  51.    function doLoadStateAction()
  52.    {
  53.       super.doLoadStateAction();
  54.       switch(this.__get__CurrentState())
  55.       {
  56.          case "Idle":
  57.             this.doSetUpIdle();
  58.             LevelEditor.__get__Instance().onMoveStop();
  59.             break;
  60.          case "Raise":
  61.             this.doSetUpRaise();
  62.             break;
  63.          case "Lower":
  64.             this.doSetUpLower();
  65.       }
  66.       this.doChangeNumber();
  67.    }
  68.    function doChangeNumber()
  69.    {
  70.       var _loc7_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
  71.       var _loc2_ = LevelEditor.__get__Instance().getNumberForPanel(_loc7_);
  72.       var _loc3_ = 0;
  73.       switch(this.__get__CurrentState())
  74.       {
  75.          case "Idle":
  76.             _loc3_ = 0;
  77.             break;
  78.          case "Raise":
  79.             _loc3_ = -1;
  80.             break;
  81.          case "Lower":
  82.             _loc3_ = 1;
  83.       }
  84.       _loc2_ += _loc3_;
  85.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  86.       {
  87.          _loc2_ = 0;
  88.       }
  89.       else if(_loc2_ < 0)
  90.       {
  91.          _loc2_ = LevelEditor.LETTERS.length - 1;
  92.       }
  93.       var _loc5_ = _loc2_ - 1;
  94.       var _loc6_ = _loc2_;
  95.       var _loc4_ = _loc2_ + 1;
  96.       if(_loc5_ < 0)
  97.       {
  98.          _loc5_ = LevelEditor.LETTERS.length - 1;
  99.       }
  100.       if(_loc4_ > LevelEditor.LETTERS.length - 1)
  101.       {
  102.          _loc4_ = 0;
  103.       }
  104.       var _loc10_ = LevelEditor.LETTERS[_loc5_];
  105.       var _loc9_ = LevelEditor.LETTERS[_loc6_];
  106.       var _loc8_ = LevelEditor.LETTERS[_loc4_];
  107.       this.mcRef.mcState.mcBoxTop.mcNumber.txtNumber.text = _loc10_;
  108.       this.mcRef.mcState.mcBoxCenter.mcNumber.txtNumber.text = _loc9_;
  109.       this.mcRef.mcState.mcBoxBottom.mcNumber.txtNumber.text = _loc8_;
  110.    }
  111.    function doSetUpIdle()
  112.    {
  113.       var _loc2_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
  114.       this.oParentMachine.setVisualForBox(_loc2_,this.mcRef.mcState.mcBoxCenter);
  115.    }
  116.    function doSetUpLower()
  117.    {
  118.       var _loc3_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
  119.       var _loc4_ = LevelEditor.__get__Instance().getNumberForPanel(_loc3_);
  120.       var _loc2_ = _loc4_ + 1;
  121.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  122.       {
  123.          _loc2_ = 0;
  124.       }
  125.       else if(_loc2_ < 0)
  126.       {
  127.          _loc2_ = LevelEditor.LETTERS.length - 1;
  128.       }
  129.       var _loc5_ = LevelEditor.__get__Instance().getPanelLinkage(_loc2_) + LevelEditor.__get__Instance().getCurrentSuffix();
  130.       this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxTop);
  131.       this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
  132.    }
  133.    function doSetUpRaise()
  134.    {
  135.       var _loc3_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
  136.       var _loc4_ = LevelEditor.__get__Instance().getNumberForPanel(_loc3_);
  137.       var _loc2_ = _loc4_ - 1;
  138.       if(_loc2_ > LevelEditor.LETTERS.length - 1)
  139.       {
  140.          _loc2_ = 0;
  141.       }
  142.       else if(_loc2_ < 0)
  143.       {
  144.          _loc2_ = LevelEditor.LETTERS.length - 1;
  145.       }
  146.       var _loc5_ = LevelEditor.__get__Instance().getPanelLinkage(_loc2_) + LevelEditor.__get__Instance().getCurrentSuffix();
  147.       this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxBottom);
  148.       this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
  149.    }
  150. }
  151.